<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control"  name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}-英文:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name_en" data-rule="required" class="form-control" name="row[name_en]" type="text" value="{$row.name_en|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">系列:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-series" class="form-control selectpicker" name="row[series_id]">
                <option value="0" selected>无</option>
                {foreach name="series" item="vo"}
                <option value="{$vo.id}" {if $row.series_id == $vo.id}selected{/if}>{$vo.name}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">材质:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-textures" class="form-control selectpicker" name="row[texture_id]">
                <option value="0" selected>无</option>
                {foreach name="textures" item="vo"}
                <option value="{$vo.id}" {if $row.texture_id == $vo.id}selected{/if}>{$vo.name}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('From')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-from" class="form-control" name="row[from]" type="text" value="{$row.from|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-keywords" class="form-control" name="row[keywords]" type="text" value="{$row.keywords|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2 text-danger">{:__('Keywords')}-英文:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-keywords_en" class="form-control" name="row[keywords_en]" type="text" value="{$row.keywords_en|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-description" class="form-control" name="row[description]" type="text" value="{$row.description|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2 text-danger">{:__('Description')}-英文:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-description_en" class="form-control" name="row[description_en]" type="text" value="{$row.description_en|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Specifications')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div id="specifications-container">
                {volist name="row.specifications" id="spec"}
                <div class="specification-item form-inline mb-2">
                    <input class="form-control" name="specifications[{$key}][spec_name]" type="text" placeholder="尺寸" value="{$spec.spec_name}" style="width: 30%;">
                    <input class="form-control" name="specifications[{$key}][spec_name2]" type="text" placeholder="颜色" value="{$spec.spec_name2}" style="width: 30%;">
                    <input class="form-control" name="specifications[{$key}][spec_price]" type="number" placeholder="价格" value="{$spec.spec_price}" style="width: 30%;">
                    <input class="form-control" name="specifications[{$key}][spec_name_en]" type="text" placeholder="尺寸-英文" value="{$spec.spec_name_en}" style="width: 30%;">
                    <input class="form-control" name="specifications[{$key}][spec_name2_en]" type="text" placeholder="颜色-英文" value="{$spec.spec_name2_en}" style="width: 30%;">
                    <input class="form-control" name="specifications[{$key}][url]" type="text" placeholder="跳转地址" value="{$spec.url}" style="width: 85%;">
                    <div class="col-xs-12 col-sm-12">
                        <div class="input-group">
                            <input id="c-image-spec-{$key}" class="form-control" size="50" name="specifications[{$key}][spec_image]" type="text" value="{$spec.spec_image|htmlentities}">
                            <div class="input-group-addon no-border no-padding">
                                <span><button type="button" id="faupload-image-spec-{$key}" class="btn btn-danger faupload" data-input-id="c-image-spec-{$key}" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image-spec-{$key}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                                <span><button type="button" id="fachoose-image-spec-{$key}" class="btn btn-primary fachoose" data-input-id="c-image-spec-{$key}" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                            </div>
                            <span class="msg-box n-right" for="c-image-spec-{$key}"></span>
                        </div>
                        <ul class="row list-inline faupload-preview" id="p-image-spec-{$key}"></ul>
                    </div>
                    <button type="button" class="btn btn-danger remove-specification">{:__('Remove')}</button>
                </div>

                {/volist}
            </div>
            <button type="button" id="add-specification" class="btn btn-default">{:__('Add Specification')}</button>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2 text-danger">{:__('Content')}-英文:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content_en" class="form-control editor" rows="5" name="row[content_en]" cols="50">{$row.content_en|htmlentities}</textarea>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Tuiswitch')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <input  id="c-tuiswitch" name="row[tuiswitch]" type="hidden" value="{$row.tuiswitch}">
            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-tuiswitch" data-yes="1" data-no="0" >
                <i class="fa fa-toggle-on text-success {eq name="$row.tuiswitch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
            </a>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Shswitch')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <input  id="c-shswitch" name="row[shswitch]" type="hidden" value="{$row.shswitch}">
            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-shswitch" data-yes="1" data-no="0" >
                <i class="fa fa-toggle-on text-success {eq name="$row.shswitch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
            </a>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('保存并预览')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
            <button type="button" class="btn btn-primary btn-embossed btn-publish" data-id="{$row.id}" style="background-color: #9f191f">{:__('发布')}</button>
        </div>
    </div>
</form>
<script>
    var initialSpecificationIndex = <?php echo count($row['specifications']) > 0 ? count($row['specifications']) : 1; ?>;
</script>